<?php

/**
 * SystemUser filter form base class.
 *
 * @package    iEasy
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseSystemUserFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'name'            => new sfWidgetFormFilterInput(),
      'password'        => new sfWidgetFormFilterInput(),
      'nickname'        => new sfWidgetFormFilterInput(),
      'real_name'       => new sfWidgetFormFilterInput(),
      'email'           => new sfWidgetFormFilterInput(),
      'telephone'       => new sfWidgetFormFilterInput(),
      'cellphone'       => new sfWidgetFormFilterInput(),
      'qq'              => new sfWidgetFormFilterInput(),
      'msn'             => new sfWidgetFormFilterInput(),
      'description'     => new sfWidgetFormFilterInput(),
      'is_online_b'     => new sfWidgetFormFilterInput(),
      'is_activate_b'   => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'catalog_list'    => new sfWidgetFormFilterInput(),
      'login_ip'        => new sfWidgetFormFilterInput(),
      'last_login_time' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
    ));

    $this->setValidators(array(
      'name'            => new sfValidatorPass(array('required' => false)),
      'password'        => new sfValidatorPass(array('required' => false)),
      'nickname'        => new sfValidatorPass(array('required' => false)),
      'real_name'       => new sfValidatorPass(array('required' => false)),
      'email'           => new sfValidatorPass(array('required' => false)),
      'telephone'       => new sfValidatorPass(array('required' => false)),
      'cellphone'       => new sfValidatorPass(array('required' => false)),
      'qq'              => new sfValidatorPass(array('required' => false)),
      'msn'             => new sfValidatorPass(array('required' => false)),
      'description'     => new sfValidatorPass(array('required' => false)),
      'is_online_b'     => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'is_activate_b'   => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'catalog_list'    => new sfValidatorPass(array('required' => false)),
      'login_ip'        => new sfValidatorPass(array('required' => false)),
      'last_login_time' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('system_user_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'SystemUser';
  }

  public function getFields()
  {
    return array(
      'system_user_id'  => 'Number',
      'name'            => 'Text',
      'password'        => 'Text',
      'nickname'        => 'Text',
      'real_name'       => 'Text',
      'email'           => 'Text',
      'telephone'       => 'Text',
      'cellphone'       => 'Text',
      'qq'              => 'Text',
      'msn'             => 'Text',
      'description'     => 'Text',
      'is_online_b'     => 'Number',
      'is_activate_b'   => 'Number',
      'catalog_list'    => 'Text',
      'login_ip'        => 'Text',
      'last_login_time' => 'Date',
    );
  }
}
